package org.ezplatform.office.meeting.info.dao;

import java.util.List;

import org.ezplatform.core.dao.jpa.JpaBaseDao;
import org.ezplatform.office.meeting.info.entity.MeetingScope;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface MeetingScopeDao extends JpaBaseDao<MeetingScope, String> {

    @Query(value = "from MeetingScope m where m.fielddatatable =?1 and m.fielddata = ?2 and m.fielddatavalue in(?3)")
    List<MeetingScope> getModelScopeList(String fielddatatable, String fieldData, List<String> fieldDataValues);
    
    @Query(value = "from MeetingScope m where m.scopevalue=?1 and m.fielddatatable=?2 and m.fielddata=?3 and m.fielddatavalue=?4")
    MeetingScope getModelScope(String scopeValue, String fielddatatable, String fieldData, String fieldDataValue);

    @Query(value = "from MeetingScope where fielddatavalue=?1")
    List<MeetingScope> getMeetingScopeList(String fieldDataValues);
    
    @Modifying
    @Query(value = "delete from  MeetingScope m where m.fielddatavalue=?1")
    void deleteScope(String emceeUser);
    
    @Modifying
	@Query(value = "update MeetingScope set scopeValue=?1, name=?2 where id=?3")
	int updateScopeValue(String scopeValue, String name, String id);
}